package com.boe.hbd.client.utils;

import android.location.Location;

import com.google.android.maps.GeoPoint;

public class GpsPoint {
	private Double latitudeE6;
	private Double longitudeE6;

	public GpsPoint(GeoPoint gp) {
		this.latitudeE6 = (double)gp.getLatitudeE6()   ;
		this.longitudeE6 = (double)gp.getLongitudeE6() ;
	}
	public GpsPoint(Location loc) {
		this.latitudeE6  = loc.getLatitude() * 1E6;
		this.longitudeE6 = loc.getLongitude()* 1E6;
	}
	public GpsPoint(double latitude, double longitude) {
		this.latitudeE6  = latitude * 1E6;
		this.longitudeE6 = longitude* 1E6;
	}

	public double getLatitude() {
		return latitudeE6 / 1E6 ;
	}

	public void setLatitude(double latitude) {
		this.latitudeE6 = latitude * 1E6 ;
	}

	public double getLongitude() {
		return longitudeE6 / 1E6 ;
	}

	public void setLongtitude(double longitude) {
		this.longitudeE6 = longitude * 1E6 ;
	}

	public GeoPoint toGeoPoint() {
		return new GeoPoint( latitudeE6.intValue() , longitudeE6.intValue());
	}
	
	public boolean equalsGeoPoint(GeoPoint gp) {
		return gp.getLatitudeE6() == latitudeE6.intValue() && gp.getLongitudeE6() == longitudeE6.intValue() ;
	}
}